package com.zzyweb.demomp.configuration;

import com.zzyweb.demomp.entity.User;
import com.zzyweb.demomp.interceptor.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zhiyi
 * @date 9/9/25
 **/
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    UserInterceptor userInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/userspace/logIn","/login.html","/register.html","/index.html");
    }
}
